package com.shop.loan.model;

import com.shop.loan.proxy.SettingProxy;
import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.BoolType;
import xyz.erupt.upms.model.base.HyperModel;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "s_setting")
@Erupt(
        name = "设置表",
        power = @Power(add = false, delete = false, viewDetails = false),
        dataProxy = SettingProxy.class
)
@Getter
@Setter
public class Setting extends HyperModel {


    //放款密码
    private String loanPassword;
    //还款密码
    private String payPassword;

    @Transient
    @EruptField(
            edit = @Edit(title = "基础设置", type = EditType.DIVIDE)
    )
    private String divide_base;

    @EruptField(
            views = @View(title = "平台标识"),
            edit = @Edit(
                    title = "平台标识",
                    notNull = true
            )
    )
    private String prefix;

    @EruptField(
            views = @View(title = "发货后付款(天)"),
            edit = @Edit(
                    title = "发货后付款(天)",
                    notNull = true
            )
    )
    private Integer signPayTime = 7;

    @EruptField(
            views = @View(title = "客服电话"),
            edit = @Edit(
                    title = "客服电话",
                    notNull = true
            )
    )
    private String serviceMobile;

    @EruptField(
            views = @View(title = "文件域名"),
            edit = @Edit(
                    title = "文件域名",
                    notNull = true
            )
    )
    private String fileDomain;

    @EruptField(
            views = @View(title = "报告有效时间(天)"),
            edit = @Edit(
                    title = "报告有效时间(天)",
                    notNull = true
            )
    )
    private Integer reportTime = 7;

    @EruptField(
            views = @View(title = "短信提醒时间"),
            edit = @Edit(
                    title = "短信提醒时间",
                    desc = "几点发送到期/逾期提醒短信",
                    notNull = true
            )
    )
    private Integer msgNotifyHour = 9;

    @EruptField(
            views = @View(title = "结清隐藏订单"),
            edit = @Edit(
                    title = "结清隐藏订单",
                    desc = "订单结清后隔天前端隐藏订单",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "是",
                            falseText = "否"
                    )
            )
    )
    private Boolean endHideOrder = true;

    @EruptField(
            views = @View(title = "是否开启一键登录"),
            edit = @Edit(
                    title = "是否开启一键登录",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "是",
                            falseText = "否"
                    )
            )
    )
    private Boolean oneKeyLogin = true;

    @Transient
    @EruptField(
            edit = @Edit(title = "默认数值设置", type = EditType.DIVIDE)
    )
    private String divide_quota;

//    @EruptField(
//            views = @View(title = "最高可借", width = "100px"),
//            edit = @Edit(
//                    title = "最高可借"
//            )
//    )
//    private BigDecimal maxMoney;

//    @EruptField(
//            views = @View(title = "借款天数"),
//            edit = @Edit(
//                    title = "借款天数"
//            )
//    )
//    private Integer loanDay;
//
//
//    @EruptField(
//            views = @View(title = "借款期数"),
//            edit = @Edit(
//                    title = "借款期数"
//            )
//    )
//    private Integer loanPeriod;
//
//    @EruptField(
//            views = @View(title = "年化利率(%)"),
//            edit = @Edit(
//                    title = "年化利率(%)"
//            )
//    )
//    private BigDecimal yearRate;
//
//
//    @EruptField(
//            views = @View(title = "担保费比例(%)", desc = "借款金额*担保费比例"),
//            edit = @Edit(
//                    title = "担保费比例(%)",
//                    desc = "借款金额*担保费比例"
//            )
//    )
//    private BigDecimal guaranteeRate;


    @Transient
    @EruptField(
            edit = @Edit(title = "流程设置", type = EditType.DIVIDE)
    )
    private String divide_flow;

    @EruptField(
            views = @View(title = "自动分配放款客服"),
            edit = @Edit(
                    title = "自动分配放款客服",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "是",
                            falseText = "否"
                    )
            )
    )
    private Boolean autoAllocLoanService;

    @EruptField(
            views = @View(title = "自动分配售后客服"),
            edit = @Edit(
                    title = "自动分配售后客服",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "是",
                            falseText = "否"
                    )
            )
    )
    private Boolean autoAllotAfterService;

    @EruptField(
            views = @View(title = "是否自动放款"),
            edit = @Edit(
                    title = "是否自动放款",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "是",
                            falseText = "否"
                    )
            )
    )
    private Boolean autoLoan;


    @EruptField(
            views = @View(title = "自动分配催收客服"),
            edit = @Edit(
                    title = "自动分配催收客服",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "是",
                            falseText = "否"
                    )
            )
    )
    private Boolean autoAllotCollectionService;

    @EruptField(
            views = @View(title = "机审自动通过/拒绝"),
            edit = @Edit(
                    title = "机审自动通过/拒绝",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "开启",
                            falseText = "关闭"
                    )
            )
    )
    private Boolean machineAuto = false;


    @EruptField(
            views = @View(title = "机审拒绝后拉黑"),
            edit = @Edit(
                    title = "机审拒绝后拉黑",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "开启",
                            falseText = "关闭"
                    )
            )
    )
    private Boolean machineAutoBlack = false;

    @EruptField(
            views = @View(title = "机审自动获取报告"),
            edit = @Edit(
                    title = "机审自动获取报告",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "是",
                            falseText = "否"
                    )
            )
    )
    private Boolean machineAutoReport = false;

    @EruptField(
            views = @View(title = "自然渠道客户拉黑"),
            edit = @Edit(
                    title = "自然渠道客户拉黑",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "是",
                            falseText = "否"
                    )
            )
    )
    private Boolean channelBlack = false;

    @Transient
    @EruptField(
            edit = @Edit(title = "代扣设置", type = EditType.DIVIDE)
    )
    private String divide_with;

    @EruptField(
            views = @View(title = "到期代扣时间"),
            edit = @Edit(
                    title = "到期代扣时间"
            )
    )
    private String withholdHour;


    @EruptField(
            views = @View(title = "逾期代扣时间"),
            edit = @Edit(
                    title = "逾期代扣时间"
            )
    )
    private String withholdHourByOverdue;


    @EruptField(
            views = @View(title = "逾期自动代扣"),
            edit = @Edit(
                    title = "逾期自动代扣",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "开启",
                            falseText = "关闭"
                    )
            )
    )
    private Boolean withholdOverdue = false;


    @EruptField(
            views = @View(title = "到期自动代扣"),
            edit = @Edit(
                    title = "到期自动代扣",
                    type = EditType.BOOLEAN,
                    boolType = @BoolType(
                            trueText = "开启",
                            falseText = "关闭"
                    )
            )
    )
    private Boolean withholdExpire = false;

}
